package dfbz.异常;

import java.io.IOException;

public class test02 {
    public static void main(String[] args) throws IOException {//向上抛给jvm
        demo01("a.txt");
    }

    private static void demo01(String s) throws IOException { //向上抛给main
        if(!s.endsWith("txt")){
            throw new IOException("文件格式错误");
        }
    }
}
